package com.hao.tool.common.enums;

import lombok.Getter;

/**
 * description
 *
 * @author RuiHaoZ on CMHK.jx
 * @date 2020-06-30 23:36
 */
@Getter
public enum ShortEnum {
    NOTICE("NOTICE", "notice/info/{id}"),
    FILE("FILE", "file/info/{id}"),
    NOT_FOUND("", "/404"),
    ;
    private String code;
    private String restUrl;

    ShortEnum(String code, String restUrl) {
        this.code = code;
        this.restUrl = restUrl;
    }

    public static ShortEnum getByCode(String code) {
        for (ShortEnum value : ShortEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return NOT_FOUND;
    }

}
